﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/**
 * 创建时间：2015/1/15 17:42:11
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.App.CacheManageConverter
{
    public class ParseComicBookPartIds
    {
        public int ComicId { get; private set; }
        public int BookId { get; private set; }
        public int PartId { get; private set; }
        public ParseComicBookPartIds()
        {
            this.ComicId = 0;
            this.BookId = 0;
            this.PartId = 0;
        }

        public void ParseCBPId(string ids)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(ids))
                {
                    var cpIds = ids.Split('#');
                    if (cpIds != null && cpIds.Length == 3)
                    {
                        int comicId = 0, bookId = 0, partId = 0;
                        int.TryParse(cpIds[0], out comicId);
                        int.TryParse(cpIds[1], out bookId);                        
                        int.TryParse(cpIds[2], out partId);

                        this.ComicId = comicId;
                        this.BookId = bookId;
                        this.PartId = partId;
                    }
                }
            }
            catch { }
        }

        public void ParseCBId(string ids)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(ids))
                {
                    var cpIds = ids.Split('#');
                    if (cpIds != null && cpIds.Length == 2)
                    {
                        int comicId = 0, bookId = 0;
                        int.TryParse(cpIds[0], out comicId);
                        int.TryParse(cpIds[1], out bookId);                        

                        this.ComicId = comicId;
                        this.BookId = bookId;
                    }
                }
            }
            catch { }
        }


    }
}
